Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename Menu components #2996

Open
wants to merge 8 commits into
base: next
Choose a base branch
from

Conversation

juliawegmayr
Copy link
Contributor

@juliawegmayr juliawegmayr commented Dec 24, 2024

Description

Rename all Menu components to better differentiate between comet and mui components:

  • Menu → MainNavigation
  • MenuItem → MainNavigationItem
  • MenuCollapsibleItem → MainNavigationCollapsibleItem
  • MenuContext → MainNavigationContext
  • MenuItemAnchorLink → MainNavigationAnchorLinkItem
  • MenuItemGroup → MainNavigationItemGroup
  • MenuItemRouterLink → MainNavigationRouterLinkItem

Acceptance criteria

Open TODOs/questions

  • Add changeset

Further information

@juliawegmayr juliawegmayr self-assigned this Dec 24, 2024
@juliawegmayr juliawegmayr force-pushed the rename-components-of-main-navigation branch 3 times, most recently from 68f98e9 to e5be58b Compare December 24, 2024 09:29
@juliawegmayr juliawegmayr force-pushed the rename-components-of-main-navigation branch 2 times, most recently from 2774972 to e31290c Compare December 30, 2024 08:50
@juliawegmayr juliawegmayr force-pushed the rename-components-of-main-navigation branch from e31290c to 2461d1d Compare December 30, 2024 09:05
@juliawegmayr juliawegmayr marked this pull request as ready for review December 30, 2024 09:28
@auto-assign auto-assign bot requested a review from johnnyomair December 30, 2024 09:28
@juliawegmayr juliawegmayr requested review from jamesricky and removed request for jamesricky December 30, 2024 09:28
@juliawegmayr juliawegmayr marked this pull request as draft December 30, 2024 09:29
@juliawegmayr juliawegmayr marked this pull request as ready for review December 30, 2024 09:34
.changeset/eighty-rockets-yell.md Outdated Show resolved Hide resolved
.changeset/eighty-rockets-yell.md Outdated Show resolved Hide resolved
docs/docs/migration/migration-from-v7-to-v8.md Outdated Show resolved Hide resolved
docs/docs/migration/migration-from-v7-to-v8.md Outdated Show resolved Hide resolved
jamesricky
jamesricky previously approved these changes Dec 30, 2024
Comment on lines +204 to +213
export { MainNavigationCollapsibleItem, MainNavigationCollapsibleItemProps } from "./mui/mainNavigation/CollapsibleItem";
export { MainNavigationCollapsibleItemClassKey } from "./mui/mainNavigation/CollapsibleItem.styles";
export { MainNavigationContext, MainNavigationContextValue, WithMainNavigation, withMainNavigation } from "./mui/mainNavigation/Context";
export { MainNavigationItem, MainNavigationItemProps } from "./mui/mainNavigation/Item";
export { MainNavigationItemClassKey } from "./mui/mainNavigation/Item.styles";
export { MainNavigationItemAnchorLink, MainNavigationItemAnchorLinkProps } from "./mui/mainNavigation/ItemAnchorLink";
export { MainNavigationItemGroup, MainNavigationItemGroupClassKey, MainNavigationItemGroupProps } from "./mui/mainNavigation/ItemGroup";
export { MainNavigationItemRouterLink, MainNavigationItemRouterLinkProps } from "./mui/mainNavigation/ItemRouterLink";
export { MainNavigation, MainNavigationProps } from "./mui/mainNavigation/MainNavigation";
export { MainNavigationClassKey } from "./mui/mainNavigation/MainNavigation.styles";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now maybe a good time to ask whether we actually need all these exports. For instance, none of our projects use withMenu. @jamesricky what do you think?

import { IMenuContext } from "./Context";
import { MenuItem as CometMenuItem, MenuItemLevel } from "./Item";
import { MainNavigationContextValue } from "./Context";
import { MainNavigationItem as CometMainNavigationItem, MainNavigationItemLevel } from "./Item";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be necessary to have import alias inside the same package IMO.

@@ -0,0 +1,28 @@
import { ComponentType, createContext, Dispatch, FunctionComponent, SetStateAction } from "react";

export interface MainNavigationContextValue {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript supports both a type and a variable with the same name, so we don't need the Value suffix.

@@ -201,18 +201,18 @@ export { useStoredState } from "./hooks/useStoredState";
export { InputWithPopper, InputWithPopperComponents, InputWithPopperProps } from "./inputWithPopper/InputWithPopper";
export { InputWithPopperClassKey } from "./inputWithPopper/InputWithPopper.slots";
export { messages } from "./messages";
export { MainNavigationCollapsibleItem, MainNavigationCollapsibleItemProps } from "./mui/mainNavigation/CollapsibleItem";
export { MainNavigationCollapsibleItemClassKey } from "./mui/mainNavigation/CollapsibleItem.styles";
export { MainNavigationContext, MainNavigationContextValue, WithMainNavigation, withMainNavigation } from "./mui/mainNavigation/Context";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to not export the context and create a useMainNavigation() or useMainNavigationApi() hook instead.

@johnnyomair
Copy link
Collaborator

Now we have the terms main navigation and master menu for related, but different things. Might this confuse devs? @jamesricky what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants